import Vue from 'vue'
import Router from 'vue-router'
import head from '@/components/login/head.vue' //菜单页面
import login from '@/components/login/login.vue' //登陆页面
import Enter from '@/components/Enter.vue' //入口页面
import register from '@/components/register.vue' //注册
import fontPage from '@/components/fontPage.vue' //忘记密码
import HomePage from '@/components/HomePage/HomePage.vue' //首页 
import MageHomePage from '@/components/MageHomePage/MageHomePage.vue' //首页 
import page2 from '@/components/HomePage/page2.vue' //首页已试算
import NewsAlert from '@/components/NewsAlert/NewsAlert.vue' //交易大厅
import PopGanda from '@/components/PopGanda/PopGanda.vue' //委托中心
import editWeit from '@/components/PopGanda/editWeit.vue' //委托中心详情
import editNewAlert from '@/components/NewsAlert/editNewAlert.vue' //委托中心详情
import Server from '@/components/Server/Server.vue' //我的授权
import Empower from '@/components/Empower/Empower.vue' 
import User from '@/components/User/User.vue' 
import News from '@/components/News/News.vue' 
import editUser from '@/components/User/editUser.vue' //查看认证证书
import queryUser from '@/components/User/queryUser.vue' //编辑认证证书
import inquiryzx from '@/components/inquiryzx/inquiryzx.vue' // 询价中心
import customerzx from '@/components/customerzx/customerzx.vue' // 客户中心
import creditLimit from '@/components/customerzx/creditLimit.vue' // 授信额度详情
import quertCustom from '@/components/customerzx/quertCustom.vue' // 客户详情
import yinhNews from '@/components/yinhNews/yinhNews.vue' // 询价中心
import accountzx from '@/components/accountzx/accountzx.vue' // 账户中心
import orderzx from '@/components/orderzx/orderzx.vue' // 订单中心
import PriceBase from '@/components/PriceBase/PriceBase.vue' // 报价设置
import editorder from '@/components/orderzx/editorder.vue' // 订单详情
import enterpriseAuthorize from '@/components/enterpriseAuthorize/enterpriseAuthorize.vue' // 订单详情
import CustomerHomePage from '@/components/CustomerHomePage/CustomerHomePage.vue' //首页

//管理端

import UserManager from '@/components/UserManager/UserManager.vue' // 用户管理
import entrustMana from '@/components/entrustMana/entrustMana.vue' // 委托管理
import rizhi from '@/components/rizhi/rizhi.vue' // 日志审计
import magaNews from '@/components/magaNews/magaNews.vue' // 消息中心
import quertMaga from '@/components/UserManager/quertMaga.vue' // 
import edentrust from '@/components/entrustMana/edentrust.vue' // 委托详情
import accountzxMaga from '@/components/accountzxMaga/accountzxMaga.vue' // 管理端账号中心
Vue.use(Router)

export const constantRoutes = [//总路由

    {
      path: '/login',
      name: 'login',
      component: login,
      meta: { 
        name: "登录页",
        auth:"pass"
       }

     },
     {
      path: '/',
      name: 'Enter',
      component: Enter,
      meta: { 
        name: "主页",
        auth:"pass"
       }
     },
   
     {
      path: '/register',
      name: 'register',
      component: register,
      meta: { 
        name: "注册",
        auth:"pass"
       }
     },
     {
      path: '/fontPage',
      name: 'fontPage',
      component: fontPage,
      meta: { 
        name: "忘记密码",
        auth:"pass"
       }
     },
]
export const route1=[ //企业客户端
    
     {
      path: '/',
      name: 'head', 
      component: head,
      // redirect: '/client/HomePage',
      children:[
        // {
        //  path:'/',
        //  redirect: 'HomePage',
        // },
        {
         path: 'HomePage',
         name: 'HomePage',
         component: HomePage,
         meta: { 
          name: "未登录交易",
          auth:"pass"
         }
        },
        {
          path: 'page2',
          name: 'page2',
          component: page2,
          meta: { 
            name: "计算页面",
            auth:"pass"
           }
         },
         
        {
         path: 'NewsAlert',
         name: 'NewsAlert',
         component: NewsAlert,
        },
        {
          path: 'editNewAlert',
          name: 'editNewAlert',
          component: editNewAlert,
         },
        {
         path: 'PopGanda',
         name: 'PopGanda',
         component: PopGanda,
        },
        {
          path: 'editWeit',
          name: 'editWeit',
          component: editWeit,
         },
        {
         path: 'Server',
         name: 'Server',
         component: Server,
        },
        {
         path: 'Empower',
         name: 'Empower',
         component: Empower,
        },
        {
         path: 'User',
         name: 'User',
         component: User,
        },
        {
          path: 'editUser',
          name: 'editUser',
          component: editUser,
         },
         {
          path: 'queryUser',
          name: 'queryUser',
          component: queryUser,
         },
        {
         path: 'News',
         name: 'News',
         component: News,
        },
       
      ]
    },
]
export const route2=[ //银行端
  {
    path: '/',
    name: 'head', 
    component: head,
    children:[
      // {
      //  path:'/',
      //  redirect: 'CustomerHomePage',
      // },
      {
        path: 'CustomerHomePage',
        name: 'CustomerHomePage',
        component: CustomerHomePage,
       },
       {
        path: 'inquiryzx',
        name: 'inquiryzx',
        component: inquiryzx,
       },
       {
        path: 'customerzx',
        name: 'customerzx',
        component: customerzx,
       },
       {
        path: 'quertCustom',
        name: 'quertCustom',
        component: quertCustom,
       },
       {
        path: 'creditLimit',
        name: 'creditLimit',
        component: creditLimit,
       },
       {
        path: 'yinhNews',
        name: 'yinhNews',
        component: yinhNews,
       },
       {
        path: 'accountzx',
        name: 'accountzx',
        component: accountzx,
       },
       {
        path: 'orderzx',
        name: 'orderzx',
        component: orderzx,
       },
       {
        path: 'PriceBase',
        name: 'PriceBase',
        component: PriceBase,
       },
       {
        path: 'editorder',
        name: 'editorder',
        component: editorder,
       },
       {
        path: 'enterpriseAuthorize',
        name: 'enterpriseAuthorize',
        component: enterpriseAuthorize,
       },
     
    ]
  },]
export const route3=[//管理端
  {
    path: '/',
    name: 'head', 
    component: head,
    children:[
      {
       path:'/',
       redirect: 'MageHomePage',
      },
      {
        path: 'MageHomePage',
        name: 'MageHomePage',
        component: MageHomePage,
       },
       {
        path: 'UserManager',
        name: 'UserManager',
        component: UserManager,
       },
       {
        path: 'entrustMana',
        name: 'entrustMana',
        component: entrustMana,
       },
       {
        path: 'edentrust',
        name: 'edentrust',
        component: edentrust,
       },
       {
        path: 'rizhi',
        name: 'rizhi',
        component: rizhi,
       },
       {
        path: 'magaNews',
        name: 'magaNews',
        component: magaNews,
       },
       {
        path: 'quertMaga',
        name: 'quertMaga',
        component: quertMaga,
       },
       {
        path: 'accountzxMaga',
        name: 'accountzxMaga',
        component: accountzxMaga,
       },

    ]
  }]
const createRouter = () => new Router({
  // mode: 'history', // require service support
  // mode: 'hash',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})
const router = createRouter()

export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router